using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Plugin;
using MicroMsg.Resource.@string;
using MicroMsg.Scene;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Imaging;
namespace MicroMsg.UI.UserContrl
{
	public class ContactsView : UserControl
	{
		public delegate void ItemCheckChanged(object sender, object object_0);
		public class ContactsViewCommand : ICommand
		{
			private bool _canExecute = true;
			private Contact mConToDel;
			public event EventHandler CanExecuteChanged;
			public bool IsEnable
			{
				get
				{
					return this._canExecute;
				}
				set
				{
					if (this._canExecute != value)
					{
						EventHandler canExecuteChanged = this.CanExecuteChanged;
						if (canExecuteChanged != null)
						{
							canExecuteChanged.Invoke(this, EventArgs.Empty);
						}
					}
					this._canExecute = value;
				}
			}
			public bool CanExecute(object parameter)
			{
				return this._canExecute;
			}
			public void MsgBoxClearDataHandler(DlgReturnEventArg dlgReturnEventArg_0)
			{
				if (this.mConToDel == null)
				{
					return;
				}
				Contact contact_0 = this.mConToDel;
				this.mConToDel = null;
				switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
				{
				case 0:
					if (MainPage.mainPageInstance == null)
					{
						return;
					}
					MainPage.ShowProgressBar(strings.Set_Plugin_UnInstalling);
					MainPage.mainPageInstance.get_Dispatcher().BeginInvoke(delegate
					{
						PluginBase plugin = ExtentCenter.findPluginByUserName(contact_0.strUsrName);
						ExtentCenter.uninstallPlugin(plugin, InstallMode.UserInstall);
						ContactsView.RefreshPlugins();
						MainPage.HideProgressBar();
					});
					break;
				case 1:
					break;
				default:
					return;
				}
			}
			public void Execute(object parameter)
			{
				Contact contact = parameter as Contact;
				if (contact == null)
				{
					return;
				}
				if (MainPage.mainPageInstance == null)
				{
					return;
				}
				if (contact != null && ContactMgr.isBlackList(contact))
				{
					ContactMgr.operationSetBlackList(contact, false);
					ServiceCenter.sceneNewSync.doScene(4, syncScene.MM_NEWSYNC_SCENE_OTHER);
					return;
				}
				ContactMgr.UserType userType = ContactMgr.getUserType(contact.strUsrName);
				ContactMgr.UserType userType2 = userType;
				switch (userType2)
				{
				case ContactMgr.UserType.UserTypeChatRoom:
				case ContactMgr.UserType.UserTypeGroupCard:
					ContactHelper.DeleteContact(contact, false);
					return;
				default:
					if (userType2 == ContactMgr.UserType.UserTypePlugin)
					{
						MMMessageBox mMMessageBox = MMMessageBox.Show("", strings.Set_Plugin_UnInstall_ClearData, true, strings.Set_Plugin_Plugin_ClearData, strings.COM_Cancel);
						mMMessageBox.set_FontSize(22.0);
						mMMessageBox.ReturnEvent = new DlgReturnEvent(this.MsgBoxClearDataHandler);
						this.mConToDel = contact;
						return;
					}
					ContactHelper.DeleteContact(contact, true);
					return;
				}
			}
		}
		public class ContactsViewPinToStartCommand : ICommand
		{
			private bool _canExecute = true;
			private Contact mConToPinToStart;
			public event EventHandler CanExecuteChanged;
			public bool IsEnable
			{
				get
				{
					return this._canExecute;
				}
				set
				{
					if (this._canExecute != value)
					{
						EventHandler canExecuteChanged = this.CanExecuteChanged;
						if (canExecuteChanged != null)
						{
							canExecuteChanged.Invoke(this, EventArgs.Empty);
						}
					}
					this._canExecute = value;
				}
			}
			public bool CanExecute(object parameter)
			{
				return this._canExecute;
			}
			public void MsgBoxClearDataHandler(DlgReturnEventArg dlgReturnEventArg_0)
			{
				if (this.mConToPinToStart == null)
				{
					return;
				}
				Contact contact_0 = this.mConToPinToStart;
				this.mConToPinToStart = null;
				switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
				{
				case 0:
					if (MainPage.mainPageInstance == null)
					{
						return;
					}
					MainPage.ShowProgressBar(strings.Set_Plugin_UnInstalling);
					MainPage.mainPageInstance.get_Dispatcher().BeginInvoke(delegate
					{
						PluginBase plugin = ExtentCenter.findPluginByUserName(contact_0.strUsrName);
						ExtentCenter.uninstallPlugin(plugin, InstallMode.UserInstall);
						ContactsView.RefreshPlugins();
						MainPage.HideProgressBar();
					});
					break;
				case 1:
					break;
				default:
					return;
				}
			}
			public void Execute(object parameter)
			{
				if (!(parameter is Contact))
				{
					return;
				}
			}
		}
		private const string TAG = "ContactsView";
		public const string cStrGroupCardHeader = "groupCardHeader@groupCardHeader";
		private const int cNGROUPCARDINDEX = 1;
		private static ContactsView sContactsViewMain = null;
		private static int sNGROUPCOUNT = 49;
		public static ObservableCollection<Group<Contact>> sListGroup = null;
		public ObservableCollection<Group<Contact>> mListGroup;
		private static int count = 0;
		private LongListSelector currentSelector;
		private Dictionary<string, Contact> mDictLinkedContacts;
		private bool mBisLoaded;
		private List<string> mListConsToRefresh = new List<string>();
		private List<string> mListUserHeadToRefresh = new List<string>();
		public int mNFilterContactsType;
		private EventWatcher mWatchContactListChange;
		private EventWatcher mWatcherHeadImgAdd;
		public static DependencyProperty mContactViewTypeProperty = DependencyProperty.Register("mContactViewType", typeof(ContactsViewType), typeof(ContactsView), new PropertyMetadata(null));
		public static DependencyProperty isBlackListProperty = DependencyProperty.Register("isBlackList", typeof(bool), typeof(ContactsView), new PropertyMetadata(null));
		public static ContentControl sCtrlForGroupHeaderVisiblility = new ContentControl();
		private bool mBControlIsInView;
		private bool mBIsFirstLoaded = true;
		private Dictionary<string, bool> mDictListToRefreshHead = new Dictionary<string, bool>();
		private static Dictionary<string, Contact> sDictFavorites = new Dictionary<string, Contact>();
		public static ContactsGroupStyle sGroupStyle = ContactsGroupStyle.NotSet;
		private bool mBIsInited;
		private bool mBIsenableContactRefresh = true;
		private ScrollViewer mScrollViewer;
		private object mGroupHeaderLocker = new object();
		public bool sBIsSelectorShown;
		private static ApplicationBar mBar;
		private static ApplicationBarMenuItem btnSetting = null;
		private static ApplicationBarMenuItem updateButton = null;
		private static ApplicationBarMenuItem searchButton = null;
		public bool IsMenuLoaded;
		private ContactsView.ContactsViewCommand mCommand;
		private ContactsView.ContactsViewPinToStartCommand mCommandPinToStart;
		public static bool sBIsShownPlugin = false;
		public static int nBIsShownPlugin = -1;
		private static bool sBIsInitPlugNeedShowList = false;
		internal UserControl ContactViewCtrl;
		internal Grid LayoutRoot;
		internal LongListSelector mListGroupContacts;
		private bool _contentLoaded;
		public event ContactsView.ItemCheckChanged mItemCheckChanged;
		public event MMUIEvent mClickToAddCallBack;
		public ContactsViewType mContactViewType
		{
			get
			{
				return (ContactsViewType)base.GetValue(ContactsView.mContactViewTypeProperty);
			}
			set
			{
				base.SetValue(ContactsView.mContactViewTypeProperty, value);
			}
		}
		public bool isBlackList
		{
			get
			{
				return (bool)base.GetValue(ContactsView.isBlackListProperty);
			}
			set
			{
				base.SetValue(ContactsView.isBlackListProperty, value);
			}
		}
		public ContactsView()
		{
			ShowObjectInMemory.AddOneObjectRecord(this);
			Log.smethod_5("ContactsView", "Construct start");
			this.InitializeComponent();
			this.mListGroupContacts.IsShowSelectorByApp = true;
			if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_MAIN)
			{
				ContactsView.sContactsViewMain = this;
			}
			base.add_Loaded(new RoutedEventHandler(this.ControlLoaded));
			base.add_Unloaded(new RoutedEventHandler(this.ControlUnLoaded));
			ContactsView.initSysPluginNeedShowList();
		}
		~ContactsView()
		{
			ShowObjectInMemory.RemoveOneObjectRecord(this);
		}
		private void registerEvent()
		{
			if (this.mWatchContactListChange == null)
			{
				this.mWatchContactListChange = new EventWatcher(this, this, new EventHandlerDelegate(this.OnContactChange));
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_DEL, this.mWatchContactListChange);
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_MODIFY, this.mWatchContactListChange);
				this.mWatcherHeadImgAdd = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerHeadImgAdd));
				EventCenter.registerEventWatcher(EventConst.ON_MGR_HEAD_IMG_READY, this.mWatcherHeadImgAdd);
			}
		}
		public void unRegisterEvent()
		{
			if (this.mWatchContactListChange != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_DEL, this.mWatchContactListChange);
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_MODIFY, this.mWatchContactListChange);
				EventCenter.removeEventWatcher(EventConst.ON_MGR_HEAD_IMG_READY, this.mWatcherHeadImgAdd);
				this.mWatchContactListChange = null;
				this.mWatcherHeadImgAdd = null;
			}
		}
		private void OnContactChange(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
			if (ContactsViewType.CONTACT_VIEW_CHECKTOADD != this.mContactViewType)
			{
				if (ContactsViewType.CONTACT_VIEW_CLICKTOADD != this.mContactViewType)
				{
					if (this.mListGroup == null)
					{
						Log.smethod_5("ContactsView", "exception in OnContactChange:null == mListGroup");
						return;
					}
					if (EventConst.ON_STORAGE_CONTACT_ADD == evtArgs.mEventID)
					{
						Log.smethod_5("ContactsView", "ON_STG_CONTACT_ADD");
						if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST)
						{
							return;
						}
						List<Contact> contactListFromEventArg = this.getContactListFromEventArg(evtArgs);
						this.applyAddToConList(contactListFromEventArg);
						return;
					}
					else
					{
						if (EventConst.ON_STORAGE_CONTACT_MODIFY == evtArgs.mEventID)
						{
							Log.smethod_5("ContactsView", "ON_STG_CONTACT_MOD start");
							List<Contact> contactListFromEventArg2 = this.getContactListFromEventArg(evtArgs);
							this.applyModToConList(contactListFromEventArg2);
							Log.smethod_5("ContactsView", "ON_STG_CONTACT_MOD end");
							return;
						}
						if (EventConst.ON_STORAGE_CONTACT_DEL == evtArgs.mEventID)
						{
							Log.smethod_5("ContactsView", "ON_STG_CONTACT_DEL");
							if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST)
							{
								return;
							}
							List<Contact> contactListFromEventArg3 = this.getContactListFromEventArg(evtArgs);
							this.applyDelToConList(contactListFromEventArg3);
						}
						return;
					}
				}
			}
		}
		private List<Contact> getContactListFromEventArg(BaseEventArgs evtArgs)
		{
			return evtArgs.getListObject<Contact>();
		}
		private void onEventHandlerHeadImgAdd(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			List<string> listObject = evtArgs.getListObject<string>();
			if (listObject == null)
			{
				return;
			}
			using (List<string>.Enumerator enumerator = listObject.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					string current = enumerator.get_Current();
					if (current != null && current.GetType() == typeof(string))
					{
						this.addUserToRereshHeadList(current);
					}
				}
			}
		}
		private void _updateUserHead(string strUserName)
		{
			ContactListItem.RefreshHeadImgInView(strUserName);
		}
		private void ControlLoaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("ContactsView", "ControlLoaded start");
			this.refreshPluginList();
			this.refreshContactPlugins();
			ContactListItem.ShowInViewItemsCachedImg();
			this.getContactInView();
			if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_MAIN)
			{
				if (MainPage.mainPageInstance == null)
				{
					this.registerEvent();
				}
				if (ContactsViewType.CONTACT_VIEW_BLACKLIST == this.mContactViewType)
				{
					this.registerEvent();
				}
				if (this.mBisLoaded)
				{
					return;
				}
				this.mBisLoaded = true;
				this.initForAddPeoplePage();
			}
			else
			{
				if (ServiceCenter.sceneNewInit.isInitDone() && this.mBIsFirstLoaded)
				{
					if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_MAIN)
					{
						List<UITask> list = new List<UITask>();
						list.Add(new UITask(new UITaskDlg(this.init), 0u));
						UITaskManager uITaskManager = new UITaskManager(list, null);
						uITaskManager.StartTasks(300u);
					}
					this.mBIsFirstLoaded = false;
				}
			}
			this.mBControlIsInView = true;
			this.procRefreshList();
			this.procRefreshHeadList();
			Log.smethod_5("ContactsView", "ControlLoaded  end");
		}
		private void ControlUnLoaded(object sender, RoutedEventArgs e)
		{
			this.mBControlIsInView = false;
			if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_MAIN && ContactsViewType.CONTACT_VIEW_BLACKLIST != this.mContactViewType)
			{
				this.unRegisterEvent();
			}
			Log.smethod_5("ContactsView", "ControlUnLoaded,type=" + this.mContactViewType);
		}
		private void procRefreshList()
		{
			if (this.mListConsToRefresh != null && this.mListConsToRefresh.get_Count() != 0)
			{
				using (List<string>.Enumerator enumerator = this.mListConsToRefresh.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						string current = enumerator.get_Current();
						ContactListItem.RefreshItemInfo(current);
					}
				}
				this.mListConsToRefresh.Clear();
			}
		}
		private void addUserToRereshList(string strUserName)
		{
			if (this.canRefreshContact())
			{
				ContactListItem.RefreshItemInfo(strUserName);
				return;
			}
			if (this.mListConsToRefresh == null)
			{
				this.mListConsToRefresh = new List<string>();
			}
			this.mListConsToRefresh.Add(strUserName);
		}
		private void procRefreshHeadList()
		{
			if (this.mDictListToRefreshHead != null && this.mDictListToRefreshHead.get_Count() != 0)
			{
				List<string> list = Enumerable.ToList<string>(this.mDictListToRefreshHead.get_Keys());
				using (List<string>.Enumerator enumerator = list.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						string current = enumerator.get_Current();
						this._updateUserHead(current);
					}
				}
				this.mDictListToRefreshHead.Clear();
			}
		}
		private void addUserToRereshHeadList(string strUserName)
		{
			if (this.canRefreshContact())
			{
				this._updateUserHead(strUserName);
				return;
			}
			if (this.mDictListToRefreshHead == null)
			{
				this.mDictListToRefreshHead = new Dictionary<string, bool>();
			}
			if (!this.mDictListToRefreshHead.ContainsKey(strUserName))
			{
				this.mDictListToRefreshHead.Add(strUserName, true);
			}
			this._updateUserHead(strUserName);
		}
		private void initContactsView()
		{
			this.InitItemSources(true);
			this.mListGroupContacts.ItemsSource = this.mListGroup;
			base.get_Dispatcher().BeginInvoke(delegate
			{
				this.getContactInView();
			});
		}
		private void InitItemSources(bool bSetToCurList = true)
		{
			ContactsView.sDictFavorites = new Dictionary<string, Contact>();
			this.mDictLinkedContacts = new Dictionary<string, Contact>();
			if (ContactsView.sListGroup != null)
			{
				if (bSetToCurList)
				{
					this.mListGroupContacts.ItemsSource = ContactsView.sListGroup;
					this.mListGroup = ContactsView.sListGroup;
				}
				return;
			}
			ObservableCollection<Group<Contact>> observableCollection = new ObservableCollection<Group<Contact>>();
			string groupTitle = ToolFunction.groupTitle;
			for (int i = 0; i < groupTitle.get_Length(); i++)
			{
				observableCollection.Add(new Group<Contact>(groupTitle.get_Chars(i).ToString(), new List<Contact>()));
			}
			ContactsView.sListGroup = observableCollection;
			ContactMgr.GetContactFromAccount(false);
			this.refreshContactPlugins();
			List<Contact> listWithOrder = StorageMgr.contact.getListWithOrder();
			this.mListGroup = ContactsView.sListGroup;
			this.applyAddToConList(listWithOrder);
		}
		private ObservableCollection<Group<Contact>> getDataForNotMainContactView(ContactsViewType type = ContactsViewType.CONTACT_VIEW_CHECKTOADD)
		{
			if (ContactsView.sListGroup == null)
			{
				ContactsViewType mContactViewType = this.mContactViewType;
				this.mContactViewType = ContactsViewType.CONTACT_VIEW_MAIN;
				this.InitItemSources(false);
				this.mContactViewType = mContactViewType;
			}
			ObservableCollection<Group<Contact>> observableCollection = new ObservableCollection<Group<Contact>>();
			if (ContactsViewType.CONTACT_VIEW_GROUPONLY_CLIKTOADD == type)
			{
				Group<Contact> group = new Group<Contact>("@", null);
				using (IEnumerator<Contact> enumerator = ContactsView.sListGroup.get_Item(1).GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						Contact current = enumerator.get_Current();
						if (current != null && current.strUsrName != null && current.strUsrName.EndsWith("@chatroom"))
						{
							group.Add(current);
						}
					}
				}
				observableCollection.Add(group);
				for (int i = 1; i < ToolFunction.groupTitle.get_Length(); i++)
				{
					string name = ToolFunction.groupTitle.get_Chars(i).ToString();
					observableCollection.Add(new Group<Contact>(name, null));
				}
			}
			else
			{
				if (type != ContactsViewType.CONTACT_VIEW_BLACKLIST)
				{
					if (ContactsView.sListGroup != null)
					{
						if (ContactsView.sNGROUPCOUNT == ContactsView.sListGroup.get_Count())
						{
							ObservableCollection<Group<Contact>> observableCollection2 = new ObservableCollection<Group<Contact>>();
							for (int j = 0; j < ContactsView.sNGROUPCOUNT; j++)
							{
								char c = ToolFunction.groupTitle.get_Chars(j);
								Group<Contact> group2 = new Group<Contact>(c.ToString(), null);
								Group<Contact> group3 = ContactsView.sListGroup.get_Item(j);
								if (c != '@' && group3 != null)
								{
									using (IEnumerator<Contact> enumerator2 = group3.GetEnumerator())
									{
										while (enumerator2.MoveNext())
										{
											Contact current2 = enumerator2.get_Current();
											if (!this.isNeedFilter(current2))
											{
												group2.Add(current2);
											}
										}
									}
									observableCollection2.Add(group2);
								}
								else
								{
									observableCollection2.Add(group2);
								}
							}
							observableCollection = observableCollection2;
							return observableCollection;
						}
					}
					return null;
				}
				ObservableCollection<Group<Contact>> observableCollection3 = new ObservableCollection<Group<Contact>>();
				string groupTitle = ToolFunction.groupTitle;
				for (int k = 0; k < groupTitle.get_Length(); k++)
				{
					observableCollection3.Add(new Group<Contact>(groupTitle.get_Chars(k).ToString(), new List<Contact>()));
				}
				List<Contact> listWithOrder = StorageMgr.contact.getListWithOrder();
				this.mListGroup = observableCollection3;
				this.applyAddToConList(listWithOrder);
				observableCollection = this.mListGroup;
			}
			return observableCollection;
		}
		public void initForAddPeoplePage()
		{
			if (this.mBIsInited)
			{
				return;
			}
			this.mBIsInited = true;
			this.regEventHandForList();
			this.mListGroup = this.getDataForNotMainContactView(this.mContactViewType);
			this.mListGroupContacts.ItemsSource = this.mListGroup;
			this.getContactInView();
		}
		private void applyAddToConList(List<Contact> contactList)
		{
			if (contactList == null)
			{
				StorageMgr.contact.dumpTable();
				return;
			}
			using (List<Contact>.Enumerator enumerator = contactList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Contact current = enumerator.get_Current();
					if (current != null && (!ToolFunction.checkIsStrSystemPlugin(current.strUsrName) || ContactsView.sBIsShownPlugin))
					{
						this.trySyncToFavoriteGroup(current);
						if (current.strUsrName != AccountMgr.strUsrName)
						{
							if (!this.isContactNeedShow(current) || this.isNeedHideForBlockFlag(current))
							{
								continue;
							}
							if (!this.canShowForIsContactFlag(current))
							{
								continue;
							}
						}
						else
						{
							if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST)
							{
								continue;
							}
						}
						string contactComString = this.getContactComString(current);
						if (this.mListGroup == null)
						{
							Log.smethod_5("ContactsView", "exception in applyAddToConList:null == mListGroup");
							return;
						}
						char groupHeader = ContactsView.getGroupHeader(current);
						int indexOfGroupList = ToolFunction.getIndexOfGroupList(groupHeader);
						Group<Contact> group = this.mListGroup.get_Item(indexOfGroupList);
						if (group == null)
						{
							Log.smethod_5("ContactsView", "exception in applyAddToConList:null == group");
							return;
						}
						if (!group.HasItems)
						{
							group.Add(current);
						}
						lock (group)
						{
							int num = 0;
							using (IEnumerator<Contact> enumerator2 = group.GetEnumerator())
							{
								while (enumerator2.MoveNext())
								{
									Contact current2 = enumerator2.get_Current();
									if (current2.strUsrName != null && current.strUsrName != null)
									{
										int num2 = current2.strUsrName.CompareTo(current.strUsrName);
										if (num2 != 0)
										{
											string contactComString2 = this.getContactComString(current2);
											num2 = contactComString.CompareTo(contactComString2);
											if (0 <= num2)
											{
												num++;
												continue;
											}
										}
										else
										{
											num = -2;
										}
										break;
									}
								}
							}
							if (-2 != num)
							{
								group.Insert(num, current);
								group.set_Item(num, group.get_Item(num));
							}
						}
					}
				}
			}
			ContactsView.RefreshGroupHeader();
			this.getContactInView();
		}
		private void applyModToConList(List<Contact> contactList)
		{
			if (contactList == null)
			{
				return;
			}
			using (List<Contact>.Enumerator enumerator = contactList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Contact current = enumerator.get_Current();
					this.trySyncToFavoriteGroup(current);
					if (this.isContactNeedShow(current))
					{
						this.getContactComString(current);
						if (this.mListGroup == null)
						{
							Log.smethod_5("ContactsView", "exception in applyModToConList:null == mListGroup");
							return;
						}
						char groupHeader = ContactsView.getGroupHeader(current);
						int num = ToolFunction.getIndexOfGroupList(groupHeader);
						Group<Contact> group = this.mListGroup.get_Item(num);
						if (group == null)
						{
							Log.smethod_5("ContactsView", "exception in applyModToConList:null == group");
							return;
						}
						bool flag = false;
						lock (group)
						{
							int num2 = 0;
							using (IEnumerator<Contact> enumerator2 = group.GetEnumerator())
							{
								while (enumerator2.MoveNext())
								{
									Contact current2 = enumerator2.get_Current();
									if (current2 != null)
									{
										int num3 = current2.strUsrName.CompareTo(current.strUsrName);
										if (num3 == 0)
										{
											flag = true;
											bool flag3 = this.isNeedHideForBlockFlag(current);
											bool flag4 = this.canShowForIsContactFlag(current);
											if ((flag3 || !flag4) && current.strUsrName != AccountMgr.strUsrName)
											{
												group.RemoveAt(num2);
											}
											else
											{
												if (this.checkIsNeedAdustPos(group, num2))
												{
													group.RemoveAt(num2);
													List<Contact> list = new List<Contact>();
													list.Add(current);
													this.applyAddToConList(list);
												}
												else
												{
													this.addUserToRereshList(current.strUsrName);
												}
											}
											break;
										}
										num2++;
									}
								}
							}
						}
						if (!flag)
						{
							num = 0;
							using (IEnumerator<Group<Contact>> enumerator3 = this.mListGroup.GetEnumerator())
							{
								while (enumerator3.MoveNext())
								{
									Group<Contact> current3 = enumerator3.get_Current();
									if (current3 != null && !(current3.Key == '*'.ToString()))
									{
										int num4 = 0;
										using (IEnumerator<Contact> enumerator4 = current3.GetEnumerator())
										{
											while (enumerator4.MoveNext())
											{
												Contact current4 = enumerator4.get_Current();
												if (current4 != null)
												{
													int num5 = current4.strUsrName.CompareTo(current.strUsrName);
													if (num5 == 0)
													{
														flag = true;
														if ((this.isNeedHideForBlockFlag(current) || !this.canShowForIsContactFlag(current)) && current.strUsrName != AccountMgr.strUsrName)
														{
															current3.RemoveAt(num4);
														}
														else
														{
															if (this.isTwoContactInSamePlace(current, current4))
															{
																current3.RemoveAt(num4);
																List<Contact> list2 = new List<Contact>();
																list2.Add(current);
																this.applyAddToConList(list2);
															}
															else
															{
																current3.RemoveAt(num4);
																List<Contact> list3 = new List<Contact>();
																list3.Add(current);
																this.applyAddToConList(list3);
															}
														}
														break;
													}
													num4++;
												}
											}
										}
										num++;
									}
								}
							}
						}
						if (!flag)
						{
							List<Contact> list4 = new List<Contact>();
							list4.Add(current);
							this.applyAddToConList(list4);
						}
					}
				}
			}
			ContactsView.RefreshGroupHeader();
		}
		private bool checkIsNeedAdustPos(Group<Contact> group, int nCurIndex)
		{
			if (group != null && nCurIndex >= 0 && nCurIndex < group.get_Count())
			{
				Contact newContact = group.get_Item(nCurIndex);
				string contactComString = this.getContactComString(newContact);
				int num = nCurIndex - 1;
				if (num >= 0)
				{
					Contact newContact2 = group.get_Item(num);
					string contactComString2 = this.getContactComString(newContact2);
					if (contactComString.CompareTo(contactComString2) < 0)
					{
						return true;
					}
				}
				int num2 = nCurIndex + 1;
				if (num2 < group.get_Count())
				{
					Contact newContact3 = group.get_Item(num2);
					string contactComString3 = this.getContactComString(newContact3);
					if (contactComString.CompareTo(contactComString3) > 0)
					{
						return true;
					}
				}
				return false;
			}
			return false;
		}
		private void applyDelToConList(List<Contact> contactList)
		{
			if (contactList == null)
			{
				return;
			}
			using (List<Contact>.Enumerator enumerator = contactList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Contact current = enumerator.get_Current();
					this.trySyncToFavoriteGroup(current);
					if (this.isContactNeedShow(current) && !this.isNeedHideForBlockFlag(current) && this.canShowForIsContactFlag(current))
					{
						this.getContactComString(current);
						if (this.mListGroup == null)
						{
							Log.smethod_5("ContactsView", "exception in applyDelToConList:null == mListGroup");
							return;
						}
						char groupHeader = ContactsView.getGroupHeader(current);
						int indexOfGroupList = ToolFunction.getIndexOfGroupList(groupHeader);
						Group<Contact> group = this.mListGroup.get_Item(indexOfGroupList);
						if (group == null)
						{
							Log.smethod_5("ContactsView", "exception in applyDelToConList:null == group");
							return;
						}
						lock (group)
						{
							using (IEnumerator<Contact> enumerator2 = group.GetEnumerator())
							{
								while (enumerator2.MoveNext())
								{
									Contact current2 = enumerator2.get_Current();
									if (current2.strUsrName != null && current.strUsrName != null)
									{
										int num = current2.strUsrName.CompareTo(current.strUsrName);
										if (num == 0)
										{
											group.Remove(current2);
											break;
										}
									}
								}
							}
						}
					}
				}
			}
			ContactsView.RefreshGroupHeader();
			this.getContactInView();
		}
		private void trySyncToFavoriteGroup(Contact contact_0)
		{
			if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST)
			{
				return;
			}
			if (contact_0 == null)
			{
				return;
			}
			if (string.IsNullOrEmpty(contact_0.strUsrName))
			{
				return;
			}
			if (ContactHelper.IsFavoriteContact(contact_0) && this.isContactNeedShow(contact_0) && this.canShowForIsContactFlag(contact_0))
			{
				if (!ContactsView.sDictFavorites.ContainsKey(contact_0.strUsrName))
				{
					ContactsView.sDictFavorites.Add(contact_0.strUsrName, contact_0);
					if (ContactsView.sListGroup == null || ContactsView.sListGroup.get_Count() == 0)
					{
						return;
					}
					Group<Contact> group = ContactsView.sListGroup.get_Item(0);
					this.insertedToGroup(group, contact_0);
				}
				this.addUserToRereshList(contact_0.strUsrName);
				return;
			}
			if (ContactsView.sDictFavorites.ContainsKey(contact_0.strUsrName))
			{
				ContactsView.sDictFavorites.Remove(contact_0.strUsrName);
				if (ContactsView.sListGroup == null || ContactsView.sListGroup.get_Count() == 0)
				{
					return;
				}
				Group<Contact> group2 = ContactsView.sListGroup.get_Item(0);
				this.removeFromGroup(group2, contact_0);
			}
		}
		private bool isContactNeedShow(Contact newContact)
		{
			if (newContact == null || newContact.strUsrName == null)
			{
				return false;
			}
			if (ToolFunction.checkIsStrSystemPlugin(newContact.strUsrName) && !ToolFunction.checkIsSysPlugNeedShow(newContact.strUsrName))
			{
				return false;
			}
			ContactMgr.UserType userType = ContactMgr.getUserType(newContact.strUsrName);
			return (ContactMgr.UserType.UserTypeNormal == userType || ContactMgr.UserType.UserTypePlugin == userType || ContactMgr.UserType.UserTypeChatRoom == userType) && (this.mContactViewType != ContactsViewType.CONTACT_VIEW_BLACKLIST || ContactMgr.UserType.UserTypeNormal == userType);
		}
		private bool canShowForIsContactFlag(Contact newContact)
		{
			return this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST || ContactMgr.isContact(newContact);
		}
		private string getContactComStringPYInitial(Contact newContact)
		{
			string result = newContact.strPYInitial;
			if (ToolFunction.checkIsLegalRemark(newContact.strRemark))
			{
				if (newContact.strRemarkPYInitial == null || newContact.strRemarkPYInitial.get_Length() == 0)
				{
					newContact.strRemarkPYInitial = SortStringsByAlpha.ConvertStringToPinyinInitial(newContact.strRemark);
				}
				result = newContact.strRemarkPYInitial;
			}
			else
			{
				if (newContact.strPYInitial == null || newContact.strPYInitial.get_Length() == 0)
				{
					if (ToolFunction.isBlankString(newContact.strNickName))
					{
						newContact.strPYInitial = SortStringsByAlpha.ConvertStringToPinyinInitial(newContact.strUsrName);
					}
					else
					{
						newContact.strPYInitial = SortStringsByAlpha.ConvertStringToPinyinInitial(newContact.strNickName);
					}
					result = newContact.strPYInitial;
				}
			}
			return result;
		}
		private string getChatRoomComString(Contact newContact)
		{
			return null;
		}
		private string getContactComString(Contact newContact)
		{
			if (ToolFunction.systemPluginNameNeedShow.Contains(newContact.strUsrName))
			{
				return "y" + 'a' + newContact.strUsrName;
			}
			if ("groupCardHeader@groupCardHeader" == newContact.strUsrName)
			{
				return "y" + 'b' + "groupCardHeader@groupCardHeader";
			}
			string text = newContact.strQuanPin;
			if (newContact.strUsrName.EndsWith("@chatroom"))
			{
				text = "QUNLIAO";
				if (!string.IsNullOrEmpty(newContact.strNickName) && newContact.strNickName != strings.ChatDefaultTopic)
				{
					if (ToolFunction.isEmptyString(newContact.strNickName))
					{
						newContact.strQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strUsrName);
					}
					else
					{
						newContact.strQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strNickName);
					}
					text = newContact.strQuanPin;
				}
				else
				{
					if (ToolFunction.checkIsLegalRemark(newContact.strRemark))
					{
						if (ToolFunction.isEmptyString(newContact.strRemarkQuanPin))
						{
							newContact.strRemarkQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strRemark);
						}
						text = newContact.strRemarkQuanPin;
					}
				}
				return "z" + text;
			}
			if (newContact.strUsrName == AccountMgr.strUsrName)
			{
				return "!a";
			}
			if (ToolFunction.checkIsLegalRemark(newContact.strRemark))
			{
				if (ToolFunction.isEmptyString(newContact.strRemarkQuanPin))
				{
					newContact.strRemarkQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strRemark);
				}
				text = newContact.strRemarkQuanPin;
			}
			else
			{
				if (ToolFunction.isEmptyString(newContact.strQuanPin))
				{
					if (ToolFunction.isEmptyString(newContact.strNickName))
					{
						newContact.strQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strUsrName);
					}
					else
					{
						newContact.strQuanPin = GetPinYin.ConvertStrToQuanPin(newContact.strNickName);
					}
					text = newContact.strQuanPin;
				}
			}
			return text.ToLower();
		}
		private bool isTwoContactInSamePlace(Contact aCon, Contact bCon)
		{
			if (aCon == bCon)
			{
				return true;
			}
			bool flag = aCon.strRemarkPYInitial == null || 0 == aCon.strRemarkPYInitial.get_Length();
			bool flag2 = bCon.strRemarkPYInitial == null || 0 == bCon.strRemarkPYInitial.get_Length();
			if (flag != flag2)
			{
				return false;
			}
			if (!flag)
			{
				return aCon.strRemarkPYInitial == bCon.strRemarkPYInitial;
			}
			bool flag3 = aCon.strPYInitial == null || 0 == aCon.strPYInitial.get_Length();
			bool flag4 = bCon.strPYInitial == null || 0 == bCon.strPYInitial.get_Length();
			return flag3 == flag4 && (flag3 || aCon.strPYInitial == bCon.strPYInitial);
		}
		private static char getGroupHeader(Contact contact)
		{
			if (contact == null)
			{
				return '#';
			}
			if (ToolFunction.checkIsStrSystemPlugin(contact.strUsrName))
			{
				return '@';
			}
			if (contact.strUsrName.EndsWith("@chatroom"))
			{
				return '&';
			}
			if (contact.strUsrName == AccountMgr.strUsrName)
			{
				return '*';
			}
			if (ContactsView.GetGroupDisplayStyle() == ContactsGroupStyle.ByStroke)
			{
				int contactStroke = ContactHelper.GetContactStroke(contact);
				if (-1 != contactStroke)
				{
					return (char)contactStroke;
				}
			}
			if (contact.strRemarkQuanPin != null && contact.strRemarkQuanPin.get_Length() != 0)
			{
				if (!ToolFunction.groupContactHeaders.Contains(ToolFunction.getUperChar(contact.strRemarkQuanPin.get_Chars(0)).ToString()))
				{
					return '#';
				}
				return ToolFunction.getUperChar(contact.strRemarkQuanPin.get_Chars(0));
			}
			else
			{
				if (ToolFunction.isBlankString(contact.strNickName))
				{
					if (!ToolFunction.groupContactHeaders.Contains(ToolFunction.getUperChar(contact.strUsrName.get_Chars(0)).ToString()))
					{
						return '#';
					}
					return ToolFunction.getUperChar(contact.strUsrName.get_Chars(0));
				}
				else
				{
					if ((contact.strQuanPin == null || contact.strQuanPin.get_Length() == 0) && !ToolFunction.isEmptyString(contact.strNickName))
					{
						contact.strQuanPin = GetPinYin.ConvertStrToQuanPin(contact.strNickName);
					}
					if (contact.strQuanPin != null && contact.strQuanPin.get_Length() != 0)
					{
						if (!ToolFunction.groupContactHeaders.Contains(ToolFunction.getUperChar(contact.strQuanPin.get_Chars(0)).ToString()))
						{
							return '#';
						}
						return ToolFunction.getUperChar(contact.strQuanPin.get_Chars(0));
					}
					else
					{
						if (!ToolFunction.isEmptyString(contact.strNickName))
						{
							contact.strQuanPin = GetPinYin.ConvertStrToQuanPin(contact.strNickName);
						}
						if (!ToolFunction.isEmptyString(contact.strUsrName))
						{
							return ToolFunction.getUperChar(contact.strUsrName.get_Chars(0));
						}
						return '#';
					}
				}
			}
		}
		private void removeItemInGroup(int nSourceIndex, int nGroupIndex)
		{
			if (nSourceIndex < 0 || nSourceIndex > this.mListGroup.get_Count() - 1)
			{
				return;
			}
			Group<Contact> group = this.mListGroup.get_Item(nSourceIndex);
			if (nGroupIndex >= 0 && nGroupIndex <= group.get_Count() - 1)
			{
				if (group.get_Count() != 0)
				{
					if (1 == group.get_Count())
					{
						this.mListGroup.set_Item(nSourceIndex, null);
						this.mListGroup.set_Item(nSourceIndex, new Group<Contact>(group.Key, new List<Contact>()));
						return;
					}
					group.RemoveAt(nGroupIndex);
					group.set_Item(group.get_Count() - 1, group.get_Item(group.get_Count() - 1));
				}
				return;
			}
		}
		private bool getContactIndexInGourp(Group<Contact> group, Contact contact_0, ref int index)
		{
			if (contact_0 != null && contact_0.strUsrName != null && group != null)
			{
				index = 0;
				string contactComString = this.getContactComString(contact_0);
				using (IEnumerator<Contact> enumerator = group.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						Contact current = enumerator.get_Current();
						if (current != null && current.strUsrName != null)
						{
							string contactComString2 = this.getContactComString(current);
							int num = contactComString2.CompareTo(contactComString);
							if (num > 0)
							{
								bool result = false;
								return result;
							}
							if (num < 0)
							{
								index++;
							}
							else
							{
								bool result;
								if (current.strUsrName != contact_0.strUsrName)
								{
									result = false;
									return result;
								}
								result = true;
								return result;
							}
						}
					}
				}
				return false;
			}
			index = -1;
			return false;
		}
		private void insertedToGroup(Group<Contact> group, Contact contact_0)
		{
			int num = -1;
			if (!this.getContactIndexInGourp(group, contact_0, ref num) && num != -1)
			{
				group.Insert(num, contact_0);
			}
		}
		private void removeFromGroup(Group<Contact> group, Contact contact_0)
		{
			int num = -1;
			if (this.getContactIndexInGourp(group, contact_0, ref num) && num != -1)
			{
				group.RemoveAt(num);
			}
		}
		private bool isNeedHideForBlockFlag(Contact contact_0)
		{
			if (contact_0 == null)
			{
				return true;
			}
			if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_BLACKLIST)
			{
				return ContactMgr.isBlackList(contact_0);
			}
			return !ContactMgr.isBlackList(contact_0);
		}
		public static ContactsGroupStyle GetGroupDisplayStyle()
		{
			if (ContactsView.sGroupStyle == ContactsGroupStyle.NotSet)
			{
				if (R.isChineseTW())
				{
					ContactsView.sGroupStyle = ContactsGroupStyle.ByStroke;
				}
				else
				{
					ContactsView.sGroupStyle = ContactsGroupStyle.Default;
				}
			}
			return ContactsView.sGroupStyle;
		}
		public void RefreshDisPlayStyle()
		{
			ContactsGroupStyle contactsGroupStyle;
			if (R.isChineseTW())
			{
				contactsGroupStyle = ContactsGroupStyle.ByStroke;
			}
			else
			{
				contactsGroupStyle = ContactsGroupStyle.Default;
			}
			if ((contactsGroupStyle == ContactsGroupStyle.ByStroke || ContactsView.sGroupStyle == ContactsGroupStyle.ByStroke) && contactsGroupStyle != ContactsView.sGroupStyle)
			{
				ContactsView.sGroupStyle = contactsGroupStyle;
				this.mListGroupContacts.ItemsSource = null;
				ContactsView.sListGroup = null;
				this.mListGroup = null;
				this.initContactsView();
			}
			ContactsView.sGroupStyle = contactsGroupStyle;
		}
		private bool isNeedFilter(Contact contact_0)
		{
			return contact_0 == null || string.IsNullOrEmpty(contact_0.strUsrName) || (this.mNFilterContactsType != 0 && (contact_0.strUsrName.EndsWith("@chatroom") || contact_0.strUsrName == AccountMgr.strUsrName || ContactHelper.IsVerifiedContact(contact_0)));
		}
		public IList<Group<Contact>> GetSelectorGroup()
		{
			if (this.mListGroup == null)
			{
				return null;
			}
			List<Group<Contact>> list = new List<Group<Contact>>();
			using (IEnumerator<Group<Contact>> enumerator = this.mListGroup.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Group<Contact> current = enumerator.get_Current();
					if (current != null && !string.IsNullOrEmpty(current.Key))
					{
						char c = current.Key.get_Chars(0);
						if (c != '*' && c != '&' && (c < '\u0001' || c > '\u0013' || ContactsView.GetGroupDisplayStyle() == ContactsGroupStyle.ByStroke))
						{
							list.Add(current);
						}
					}
				}
			}
			return list;
		}
		public void init()
		{
			if (this.mBIsInited)
			{
				return;
			}
			this.mBIsInited = true;
			this.regEventHandForList();
			this.initContactsView();
			this.registerEvent();
		}
		public static void resetCheckedList()
		{
			ContactListItem.mDictContactChoosen = new Dictionary<string, Contact>();
			ContactsView.setDisabledContact(new List<string>());
		}
		public static void resetCheckedList(List<string> listUserToFilter)
		{
			ContactListItem.mDictContactChoosen = new Dictionary<string, Contact>();
			ContactsView.setDisabledContact(listUserToFilter);
		}
		public void CheckAllContacts()
		{
			if (ContactListItem.mDictContactChoosen == null)
			{
				ContactListItem.mDictContactChoosen = new Dictionary<string, Contact>();
			}
			ObservableCollection<Group<Contact>> observableCollection = this.mListGroup;
			if (observableCollection == null)
			{
				return;
			}
			using (IEnumerator<Group<Contact>> enumerator = observableCollection.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Group<Contact> current = enumerator.get_Current();
					if (current != null)
					{
						using (IEnumerator<Contact> enumerator2 = current.GetEnumerator())
						{
							while (enumerator2.MoveNext())
							{
								Contact current2 = enumerator2.get_Current();
								if (current2 != null && current2.strUsrName != null && !ContactListItem.mDictContactChoosen.ContainsKey(current2.strUsrName))
								{
									ContactListItem.mDictContactChoosen.Add(current2.strUsrName, current2);
								}
							}
						}
					}
				}
			}
			ContactListItem.CheckedAllItemInView();
		}
		public static void UnCheckAllContacts()
		{
			if (ContactListItem.mDictContactChoosen == null)
			{
				ContactListItem.mDictContactChoosen = new Dictionary<string, Contact>();
			}
			ContactListItem.mDictContactChoosen.Clear();
			ContactListItem.UnCheckAllItemInView();
		}
		public static List<Contact> getCheckedItem()
		{
			return Enumerable.ToList<Contact>(ContactListItem.mDictContactChoosen.get_Values());
		}
		private static void setDisabledContact(List<string> listUserToFilter)
		{
			ContactListItem.sListContactsDisable = listUserToFilter;
		}
		public void logOutForContactList()
		{
			this.unRegisterEvent();
			this.mListGroupContacts.ItemsSource = null;
			ContactsView.sListGroup = null;
			ContactsView.count = 0;
			this.mDictLinkedContacts = null;
			this.mBisLoaded = false;
			ContactsView.sContactsViewMain = null;
		}
		public void ScrollToFirstItem()
		{
			if (this.mListGroup != null && this.mListGroup.get_Count() != 0 && this.mScrollViewer != null && this.mScrollViewer.get_VerticalOffset() > 0.2)
			{
				this.mScrollViewer.ScrollToVerticalOffset(0.0);
			}
		}
		public static void RefreshGroupHeader()
		{
		}
		public static bool IsNeedShowGroupHeader()
		{
			return true;
		}
		public static Group<Contact> GetChatRoomList()
		{
			if (ContactsView.sListGroup == null)
			{
				return null;
			}
			return ContactsView.sListGroup.get_Item(2);
		}
		public void EnableContactRefresh()
		{
			this.mBIsenableContactRefresh = true;
			base.get_Dispatcher().BeginInvoke(delegate
			{
				this.procRefreshHeadList();
				this.procRefreshList();
			});
		}
		public void DisableContactRefresh()
		{
			this.mBIsenableContactRefresh = false;
		}
		private bool canRefreshContact()
		{
			return this.mBControlIsInView && this.mBIsenableContactRefresh;
		}
		private void getScrollViewer()
		{
			ScrollViewer scrollViewer = UIElementTraveler.FindElementRecursive(this.mListGroupContacts, typeof(ScrollViewer)) as ScrollViewer;
			if (scrollViewer == null)
			{
				Log.smethod_5("ContactsView", "getScrollViewer sv == null");
			}
			this.mScrollViewer = scrollViewer;
		}
		private void regEventHandForList()
		{
			this.getScrollViewer();
			this.mListGroupContacts.ScrollingStarted += new EventHandler(this.selector_ScrollingStarted);
			this.mListGroupContacts.ScrollingCompleted += new EventHandler(this.selector_ScrollingCompleted);
			this.mListGroupContacts.Link += new EventHandler<LinkUnlinkEventArgs>(this.selector_Link);
			this.mListGroupContacts.Unlink += new EventHandler<LinkUnlinkEventArgs>(this.selector_Unlink);
		}
		private void selector_ScrollingStarted(object sender, EventArgs e)
		{
			ContactListItem.sBIsScrolling = true;
		}
		private void selector_ScrollingCompleted(object sender, EventArgs e)
		{
			if (this.mScrollViewer != null)
			{
				this.mScrollViewer.ScrollToVerticalOffset(this.mScrollViewer.get_VerticalOffset());
			}
			this.getContactInView();
			ContactListItem.ShowInViewItemsCachedImg();
			ContactListItem.sBIsScrolling = false;
			this.mListGroupContacts.UpdateLayout();
		}
		public List<Contact> getContactInView()
		{
			ObservableCollection<Group<Contact>> observableCollection = (ObservableCollection<Group<Contact>>)this.mListGroupContacts.ItemsSource;
			if (this.mScrollViewer == null)
			{
				this.getScrollViewer();
			}
			if (this.mScrollViewer != null && observableCollection != null)
			{
				int num = (int)this.mScrollViewer.get_VerticalOffset();
				int num2 = num - 1;
				int num3 = 9;
				if (num2 <= 0)
				{
					num3 = 7;
					num2 = 0;
				}
				int num4 = 0;
				int num5 = 0;
				int num6 = 0;
				for (int i = 0; i < observableCollection.get_Count(); i++)
				{
					if (observableCollection.get_Item(i).get_Count() != 0)
					{
						if (num6 + observableCollection.get_Item(i).get_Count() + 1 > num2)
						{
							num4 = i;
							num5 = num2 - num6 - 1;
							IL_B8:
							if (-1 == num5)
							{
								num5 = 0;
								num3--;
							}
							List<Contact> list = new List<Contact>();
							while (num3 > 0 && num4 <= observableCollection.get_Count() - 1)
							{
								if (observableCollection.get_Item(num4).get_Count() == 0)
								{
									num4++;
								}
								else
								{
									if (num5 > observableCollection.get_Item(num4).get_Count() - 1)
									{
										num4++;
										num5 = 0;
										num3--;
									}
									else
									{
										if (observableCollection.get_Item(num4).get_Item(num5).strUsrName != "groupCardHeader@groupCardHeader")
										{
											list.Add(observableCollection.get_Item(num4).get_Item(num5));
											BitmapImage headImage = HeadImgMgr.getHeadImage(observableCollection.get_Item(num4).get_Item(num5));
											if (headImage != HeadImageMgr.defaultHeadImage)
											{
												this._updateUserHead(observableCollection.get_Item(num4).get_Item(num5).strUsrName);
											}
										}
										num5++;
										num3--;
									}
								}
							}
							return list;
						}
						num6 += observableCollection.get_Item(i).get_Count() + 1;
					}
				}
				goto IL_B8;
			}
			return null;
		}
		private void selector_Link(object sender, LinkUnlinkEventArgs e)
		{
			ContactsView.count++;
		}
		private void selector_Unlink(object sender, LinkUnlinkEventArgs e)
		{
			ContactsView.count--;
		}
		private void ContactListItem_CheckNotify(object sender, object object_0)
		{
			this.mItemCheckChanged(this, null);
		}
		private void ContactListItem_ItemClick(object sender, object object_0)
		{
			Contact contact = object_0 as Contact;
			if (contact == null)
			{
				return;
			}
			if (contact != null && contact.strUsrName == "groupCardHeader@groupCardHeader")
			{
				this.ShownSelector();
				return;
			}
			if (ContactsViewType.CONTACT_VIEW_CHECKTOADD == this.mContactViewType)
			{
				List<UIElement> list = UIElementTraveler.FindAllElement(this, typeof(ContactListItem));
				using (List<UIElement>.Enumerator enumerator = list.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						UIElement current = enumerator.get_Current();
						ContactListItem contactListItem = current as ContactListItem;
						if (contactListItem != null && contactListItem.ItemObject != null && contactListItem.ItemObject.strUsrName == contact.strUsrName)
						{
							contactListItem.simulateCheckBoxHit();
						}
					}
					return;
				}
			}
			if (ContactsViewType.CONTACT_VIEW_CLICKTOADD != this.mContactViewType)
			{
				if (ContactsViewType.CONTACT_VIEW_GROUPONLY_CLIKTOADD != this.mContactViewType)
				{
					if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_MAIN || ContactsViewType.CONTACT_VIEW_BLACKLIST == this.mContactViewType)
					{
						ContactsView.GoToContactDetailPage(contact);
						return;
					}
					return;
				}
			}
			if (this.mClickToAddCallBack != null)
			{
				if (contact != null && !ContactListItem.sListContactsDisable.Contains(contact.strUsrName))
				{
					this.mClickToAddCallBack(this, contact);
					return;
				}
				return;
			}
		}
		public void ShownSelector()
		{
			lock (this.mGroupHeaderLocker)
			{
				if (this.sBIsSelectorShown)
				{
					Log.smethod_5("ContactsView", "Selector has shown ,cancel");
					return;
				}
				Log.smethod_5("ContactsView", "ShownSelector");
				this.sBIsSelectorShown = true;
			}
			this.mListGroupContacts.DisplayGroupView();
		}
		private void GroupHeaderClick(object sender, object object_0)
		{
			this.ShownSelector();
		}
		public static void GoToContactDetailPage(Contact contact)
		{
			if (contact == null)
			{
				return;
			}
			ContactMgr.UserType userType = ContactMgr.getUserType(contact.strUsrName);
			if (ContactMgr.UserType.UserTypePlugin == userType)
			{
				if (contact.strUsrName.CompareTo("weixin") == 0)
				{
					ContactDetailViewForAll.GotoContactDitailView(strings.COM_ConList, strings.COM_ConDetail, contact, ContactDetailFromType.FROM_MMCONTACT, false);
					return;
				}
				PluginBase pluginBase = ExtentCenter.findPluginByUserName(contact.strUsrName);
				pluginBase.execute(2, null);
				return;
			}
			else
			{
				if (ContactMgr.UserType.UserTypeNormal == userType)
				{
					ContactDetailViewForAll.GotoContactDitailView(strings.COM_ConList, strings.COM_ConDetail, contact, ContactDetailFromType.FROM_MMCONTACT, false);
					return;
				}
				if (ContactMgr.UserType.UserTypeChatRoom == userType)
				{
					ToolFunction.GotoPageForUserControl("/Source/UI/Contact/GroupCardView.xaml", new object[]
					{
						contact
					}, false);
				}
				return;
			}
		}
		public static void GoToPageForSecondeTile(Contact contact)
		{
			if (contact == null)
			{
				return;
			}
			ContactMgr.UserType userType = ContactMgr.getUserType(contact.strUsrName);
			if (ContactMgr.UserType.UserTypePlugin == userType)
			{
				if (contact.strUsrName.CompareTo("weixin") == 0)
				{
					ContactDetailViewForAll.GotoContactDitailView(strings.COM_ConList, strings.COM_ConDetail, contact, ContactDetailFromType.FROM_MMCONTACT, false);
					return;
				}
				PluginBase pluginBase = ExtentCenter.findPluginByUserName(contact.strUsrName);
				pluginBase.execute(2, null);
				return;
			}
			else
			{
				if (ContactMgr.UserType.UserTypeNormal == userType)
				{
					ChatContainerPage.GoToChatPage(new BasePage(), contact.strUsrName, null, null, null);
					return;
				}
				if (ContactMgr.UserType.UserTypeChatRoom == userType)
				{
					ToolFunction.GotoPageForUserControl("/Source/UI/Contact/GroupCardView.xaml", new object[]
					{
						contact
					}, false);
				}
				return;
			}
		}
		private void LongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			if (this.mListGroupContacts.SelectedItem == null)
			{
				return;
			}
			this.ContactListItem_ItemClick(sender, this.mListGroupContacts.SelectedItem);
			this.mListGroupContacts.SelectedItem = null;
		}
		public static ApplicationBar GetApplicationBar(bool useCache = true)
		{
			if (ContactsView.mBar != null && useCache)
			{
				if (!ContactsView.mBar.get_IsVisible())
				{
					ContactsView.mBar.set_IsVisible(true);
				}
				return ContactsView.mBar;
			}
			ContactsView.mBar = new ApplicationBar();
			ContactsView.mBar.set_IsMenuEnabled(true);
			ContactsView.mBar.set_IsVisible(true);
			ContactsView.searchButton = new ApplicationBarMenuItem(strings.COM_Search);
			ContactsView.searchButton.add_Click(new EventHandler(ContactsView.btnBarCode_Click));
			ContactsView.mBar.get_MenuItems().Add(ContactsView.searchButton);
			ContactsView.btnSetting = new ApplicationBarMenuItem(strings.COM_Setting);
			ContactsView.btnSetting.add_Click(new EventHandler(ContactsView.btnSetting_Click));
			ContactsView.mBar.get_MenuItems().Add(ContactsView.btnSetting);
			if (MainPage.mainPageInstance != null && MainPage.mainPageInstance.m_UpdateInfo != null)
			{
				ContactsView.updateButton = new ApplicationBarMenuItem(strings.Set_AboutMM_Update);
				ContactsView.updateButton.add_Click(new EventHandler(ContactsView.btnUpdateVersion_Click));
				ContactsView.mBar.get_MenuItems().Add(ContactsView.updateButton);
			}
			return ContactsView.mBar;
		}
		private static void btnTestContact_Click(object sender, EventArgs e)
		{
			TestContactItemPage.GotoThisPage("mmteam");
		}
		private static void testCb(object obj1, object obj2)
		{
		}
		private static void btnSnsGroup_Click(object sender, EventArgs e)
		{
			SetPostVisibilityPage.GotoThisPage(new MMStandardUIEvent(ContactsView.testCb), new List<ulong>());
		}
		private static void btnUpdateVersion_Click(object sender, EventArgs e)
		{
			if (MainPage.mainPageInstance != null && MainPage.mainPageInstance.m_UpdateInfo != null)
			{
				string text = (MainPage.mainPageInstance.m_UpdateInfo.PackSize * 1.0 / 1048576.0).ToString();
				int num = (text.get_Length() > 3) ? 3 : text.get_Length();
				text = text.Substring(0, num);
				MMMessageBox mMMessageBox = MMMessageBox.Show(strings.Set_AboutMM_HasNewVersion, string.Concat(new string[]
				{
					MainPage.mainPageInstance.m_UpdateInfo.PackDescription,
					"\r\n",
					strings.Set_AboutMM_PackageSize,
					text,
					"MB"
				}), true, strings.Set_AboutMM_Update, strings.COM_Cancel);
				mMMessageBox.ReturnEvent = new DlgReturnEvent(MainPage.mainPageInstance.updateInfoDlgReturn);
			}
		}
		private static void btnSeeMemory_Click(object sender, EventArgs e)
		{
			SeeMemoryPage.onLoaded = null;
			ToolFunction.GotoPageForUserControl("/Source/UI/LogView/SeeMemoryPage.xaml", null, false);
		}
		private static void refreshPageNavSpeed(SeeMemoryPage seeMemoryPage_0)
		{
			seeMemoryPage_0.setContent(BasePage.getPageNavInfo(), "页面切换速度");
		}
		private static void btnSeePageNavSpeed_Click(object sender, EventArgs e)
		{
			BasePage.logPageSpeed();
			SeeMemoryPage.onLoaded = new Action<SeeMemoryPage>(ContactsView.refreshPageNavSpeed);
			ToolFunction.GotoPageForUserControl("/Source/UI/LogView/SeeMemoryPage.xaml", null, false);
		}
		private static void btnTestPage_Click(object sender, EventArgs e)
		{
			ToolFunction.GotoPageForUserControl("/Source/UI/LogView/TestPage.xaml", null, false);
		}
		private static void btnTestExternal_Click(object sender, EventArgs e)
		{
		}
		private static void btnGoSnsClear_Click(object sender, EventArgs e)
		{
			ToolFunction.GotoPageForUserControl("/Source/Plugin/Sns/Album/UI/SnsTestMainPage.xaml", null, false);
		}
		private static void btnChangeBG_Click(object sender, EventArgs e)
		{
		}
		private void btnGoBottleSet_Click(object sender, EventArgs e)
		{
			CirclePagePicsCtrl circlePagePicsCtrl = new CirclePagePicsCtrl();
			circlePagePicsCtrl.RunTest();
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
		}
		private static void btnSetting_Click(object sender, EventArgs e)
		{
			MainPage.goToSetting();
		}
		private static void btnLogout_Click(object sender, EventArgs e)
		{
			MainPage.initLogOut();
		}
		private static void btnBarCode_Click(object sender, EventArgs e)
		{
			ObservableCollection<Group<Contact>> observableCollection = ContactsView.sListGroup;
			List<SearchItem> list = new List<SearchItem>();
			int type = 7;
			if (observableCollection != null)
			{
				using (IEnumerator<Group<Contact>> enumerator = observableCollection.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						Group<Contact> current = enumerator.get_Current();
						if (current != null)
						{
							using (IEnumerator<Contact> enumerator2 = current.GetEnumerator())
							{
								while (enumerator2.MoveNext())
								{
									Contact current2 = enumerator2.get_Current();
									if (!(current2.strUsrName == "groupCardHeader@groupCardHeader"))
									{
										list.Add(new SearchItem(current2, ContactsView.getContactShowName(current2), type, null));
									}
								}
							}
						}
					}
				}
			}
			SearchAlgorithm searchAlgorithm = new SearchAlgorithm(list);
			ToolFunction.GotoPageForUserControl("/Source/UI/ListSearchHelper/ListSearchPage.xaml", new object[]
			{
				searchAlgorithm
			}, false);
		}
		private static string getContactShowName(Contact item)
		{
			if (item == null)
			{
				return "";
			}
			return ContactHelper.getDisplayName(item.strUsrName, item);
		}
		private static void btnSeeLog_Click(object sender, EventArgs e)
		{
			if (!Log.sBIsWriteToLogView)
			{
				return;
			}
			ToolFunction.GotoPageForUserControl("/Source/UI/LogView/LogView.xaml", null, false);
		}
		private void ContactList_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
		}
		private void ContactList_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
		}
		private void ContactList_Tap(object sender, GestureEventArgs e)
		{
		}
		private void LongListSelector_GroupViewOpened(object sender, GroupViewOpenedEventArgs e)
		{
			ContactsViewSelector.ShowSelector(this);
		}
		public void GroupChoosen(string strKey)
		{
			ObservableCollection<Group<Contact>> observableCollection = (ObservableCollection<Group<Contact>>)this.mListGroupContacts.ItemsSource;
			if (this.mScrollViewer != null && observableCollection != null)
			{
				double num = 0.0;
				using (IEnumerator<Group<Contact>> enumerator = observableCollection.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						Group<Contact> current = enumerator.get_Current();
						if (current.Key == strKey)
						{
							break;
						}
						if (current.get_Count() != 0)
						{
							num += (double)(current.get_Count() + 1);
						}
					}
				}
				this.mScrollViewer.ScrollToVerticalOffset(num);
				return;
			}
		}
		private void ItemsControl_Unloaded(object sender, RoutedEventArgs e)
		{
			if (MainPage.mainPageInstance != null)
			{
				MainPage.mainPageInstance.mNBackKeyRelayCount--;
			}
		}
		private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
		{
		}
		private void _swivelHide_Completed(object sender, EventArgs e)
		{
			if (this.currentSelector != null)
			{
				this.currentSelector.CloseGroupView();
				this.currentSelector = null;
				this.getContactInView();
				this.sBIsSelectorShown = false;
			}
		}
		public void CustomeMizeListItem(object sender, object object_0)
		{
			if (sender == null || !(sender is ContactListItem))
			{
				return;
			}
			ContactListItem contactListItem = sender as ContactListItem;
			contactListItem.mConItemType = this.mContactViewType;
			if (ContactsViewType.CONTACT_VIEW_CHECKTOADD == this.mContactViewType)
			{
				contactListItem.checkBoxChoosen.set_Visibility(0);
				return;
			}
			contactListItem.checkBoxChoosen.set_Visibility(1);
		}
		public void OnLanguageChange()
		{
			if (ContactsView.btnSetting != null)
			{
				ContactsView.btnSetting.set_Text(strings.COM_Setting);
			}
			if (ContactsView.updateButton != null)
			{
				ContactsView.updateButton.set_Text(strings.Set_AboutMM_Update);
			}
			if (ContactsView.searchButton != null)
			{
				ContactsView.searchButton.set_Text(strings.COM_Search);
			}
			this.addUserToRereshList("weixin");
			this.addUserToRereshList(AccountMgr.strUsrName);
			List<PluginBase> listInTab = ExtentCenter.getListInTab(MainTabIndex.ContactTab);
			if (listInTab != null)
			{
				using (List<PluginBase>.Enumerator enumerator = listInTab.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						PluginBase current = enumerator.get_Current();
						if (current.isInstalledPlugin())
						{
							this.addUserToRereshList(current.mUserName);
						}
					}
				}
			}
			this.RefreshDisPlayStyle();
		}
		private string getContextMenuHeader(Contact contact_0)
		{
			if (contact_0 == null)
			{
				return null;
			}
			if (this.mContactViewType == ContactsViewType.CONTACT_VIEW_BLACKLIST)
			{
				return strings.Set_BlackList_Remove;
			}
			if (ToolFunction.systemPluginName.Contains(contact_0.strUsrName))
			{
				return strings.Plugin_UnInstall;
			}
			return strings.Con_Detail_BtnDel;
		}
		private void contextMunu_Loaded(object sender, RoutedEventArgs e)
		{
			MainPage.mainPageInstance.mNBackKeyRelayCount++;
			this.IsMenuLoaded = true;
			if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_MAIN)
			{
				if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_BLACKLIST)
				{
					((ContextMenu)((MenuItem)sender).get_Parent()).IsOpen = false;
					return;
				}
			}
			MenuItem menuItem = sender as MenuItem;
			if (menuItem != null && menuItem.CommandParameter != null)
			{
				Contact contact_ = menuItem.CommandParameter as Contact;
				menuItem.Header = this.getContextMenuHeader(contact_);
				menuItem.Command = this.getCommand();
				return;
			}
		}
		private void contextMunu_Unloaded(object sender, RoutedEventArgs e)
		{
			if (MainPage.mainPageInstance != null)
			{
				MainPage.mainPageInstance.mNBackKeyRelayCount--;
			}
			this.IsMenuLoaded = false;
		}
		private string getContextMenuPinToStartHeader(Contact contact_0)
		{
			if (contact_0 == null)
			{
				return null;
			}
			return "Pin To Start";
		}
		private void contextMenuPinToStart_Loaded(object sender, RoutedEventArgs e)
		{
			MainPage.mainPageInstance.mNBackKeyRelayCount++;
			this.IsMenuLoaded = true;
			if (this.mContactViewType != ContactsViewType.CONTACT_VIEW_MAIN)
			{
				((ContextMenu)((MenuItem)sender).get_Parent()).IsOpen = false;
				return;
			}
			MenuItem menuItem = sender as MenuItem;
			if (menuItem != null && menuItem.CommandParameter != null)
			{
				Contact contact_ = menuItem.CommandParameter as Contact;
				menuItem.Header = this.getContextMenuPinToStartHeader(contact_);
				menuItem.Command = this.getCommandPinToStart();
				return;
			}
		}
		private void contextMenuPinToStart_Unloaded(object sender, RoutedEventArgs e)
		{
			if (MainPage.mainPageInstance != null)
			{
				MainPage.mainPageInstance.mNBackKeyRelayCount--;
			}
			this.IsMenuLoaded = false;
		}
		private ContactsView.ContactsViewCommand getCommand()
		{
			if (this.mCommand == null)
			{
				this.mCommand = new ContactsView.ContactsViewCommand();
			}
			return this.mCommand;
		}
		private ContactsView.ContactsViewPinToStartCommand getCommandPinToStart()
		{
			if (this.mCommandPinToStart == null)
			{
				this.mCommandPinToStart = new ContactsView.ContactsViewPinToStartCommand();
			}
			return this.mCommandPinToStart;
		}
		public static void RefreshPlugins()
		{
			if (ContactsView.sContactsViewMain == null)
			{
				return;
			}
			ContactsView.sContactsViewMain.refreshPluginList();
			ContactsView.sContactsViewMain.refreshContactPlugins();
		}
		private Contact AddPluginToContactView(string pluginName, uint nFlagas = 3u)
		{
			Contact contact = new Contact();
			contact.strUsrName = pluginName;
			contact.nFlags = nFlagas;
			contact.nImgFlag = 3u;
			StorageMgr.contact.update(contact);
			return contact;
		}
		private void refreshContactPlugins()
		{
			if (!ContactsView.sBIsShownPlugin)
			{
				return;
			}
			List<PluginBase> allListInTab = ExtentCenter.getAllListInTab(MainTabIndex.ContactTab);
			if (allListInTab == null)
			{
				return;
			}
			using (List<PluginBase>.Enumerator enumerator = allListInTab.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					PluginBase current = enumerator.get_Current();
					if (current != null)
					{
						Contact contact = StorageMgr.contact.method_0(current.mUserName);
						if (contact == null)
						{
							contact = this.AddPluginToContactView(current.mUserName, 3u);
						}
						if (ContactMgr.isContact(contact))
						{
							if (!current.isInstalledPlugin())
							{
								this.AddPluginToContactView(current.mUserName, 0u);
							}
						}
						else
						{
							if (current.isInstalledPlugin())
							{
								this.AddPluginToContactView(current.mUserName, 3u);
							}
						}
					}
				}
			}
		}
		private static void initSysPluginNeedShowList()
		{
			if (ContactsView.sBIsInitPlugNeedShowList)
			{
				return;
			}
			ContactsView.sBIsInitPlugNeedShowList = true;
			List<PluginBase> allListInTab = PluginManager.getAllListInTab(MainTabIndex.ContactTab);
			if (allListInTab == null)
			{
				Log.smethod_5("ContactsView", "initSysPluginNeedShowListnull == listPlugin");
				return;
			}
			using (List<PluginBase>.Enumerator enumerator = allListInTab.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					PluginBase current = enumerator.get_Current();
					if (current != null)
					{
						Log.smethod_5("ContactsView", "initSysPluginNeedShowListget plugin" + current.mUserName);
						if (!string.IsNullOrEmpty(current.mUserName) && (current.mIndexInTab & MainTabIndex.ContactTab) != (MainTabIndex)0)
						{
							if (!ToolFunction.systemPluginNameNeedShow.Contains(current.mUserName))
							{
								ToolFunction.systemPluginNameNeedShow.Add(current.mUserName);
								Log.smethod_5("ContactsView", "initSysPluginNeedShowListsystemPluginNameNeedShow to" + current.mUserName);
							}
							if (!ToolFunction.systemPluginName.Contains(current.mUserName))
							{
								ToolFunction.systemPluginName.Add(current.mUserName);
								Log.smethod_5("ContactsView", "initSysPluginNeedShowListsystemPluginName to" + current.mUserName);
							}
						}
					}
				}
			}
		}
		private void refreshPluginList()
		{
			bool @bool;
			if ((@bool = ConfigMgr.getBool("SHOW_IN_CONTACTS_KEY", true)) != ContactsView.sBIsShownPlugin)
			{
				ContactsView.sBIsShownPlugin = @bool;
				List<Contact> list = new List<Contact>();
				using (List<string>.Enumerator enumerator = ToolFunction.systemPluginNameNeedShow.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						string current = enumerator.get_Current();
						list.Add(StorageMgr.contact.method_0(current));
					}
				}
				if (ContactsView.sBIsShownPlugin)
				{
					List<Contact> list2 = new List<Contact>();
					List<PluginBase> allListInTab = PluginManager.getAllListInTab(MainTabIndex.ContactTab);
					if (allListInTab != null && allListInTab.get_Count() > 0)
					{
						using (List<PluginBase>.Enumerator enumerator2 = allListInTab.GetEnumerator())
						{
							while (enumerator2.MoveNext())
							{
								PluginBase current2 = enumerator2.get_Current();
								if (current2 != null && (current2.mIndexInTab & MainTabIndex.ContactTab) != (MainTabIndex)0)
								{
									list2.Add(StorageMgr.contact.method_0(current2.mUserName));
								}
							}
						}
					}
					this.applyAddToConList(list2);
					List<PluginBase> uninstalledList = PluginManager.getUninstalledList();
					if (uninstalledList == null || uninstalledList.get_Count() <= 0)
					{
						return;
					}
					using (List<PluginBase>.Enumerator enumerator3 = uninstalledList.GetEnumerator())
					{
						while (enumerator3.MoveNext())
						{
							PluginBase current3 = enumerator3.get_Current();
							if (current3 != null && (current3.mIndexInTab & MainTabIndex.ContactTab) != (MainTabIndex)0)
							{
								Contact contact = StorageMgr.contact.method_0(current3.mUserName);
								if (contact != null && contact.nFlags != 0u)
								{
									contact.nFlags = 0u;
									StorageMgr.contact.update(contact);
								}
							}
						}
						return;
					}
				}
				if (ContactsView.sListGroup != null && ContactsView.sListGroup.get_Count() > 2)
				{
					ContactsView.sListGroup.get_Item(1).Clear();
				}
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Contact/ContactsView.xaml", 2));
			this.ContactViewCtrl = (UserControl)base.FindName("ContactViewCtrl");
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.mListGroupContacts = (LongListSelector)base.FindName("mListGroupContacts");
		}
	}
}
